<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

//支持get|post传参
Route::group(['namespace'=>'App\Http\Controllers\Api'],function(){
    //开奖
    Route::any('/openResult','Controller@openResult');
    //用户登录
    Route::any('/login', 'LoginController@login');
    //游客登录
    Route::any('/customLogin', 'LoginController@customLogin');
    //业务层
    Route::group(['middleware'=>['token']],function (){
        //为访问的client用户进行加时操作
        Route::any('/', 'Controller@addExpire');
        //逻辑处理层(用户逻辑层)
        Route::group(['prefix'=>'/user'],function () {
            Route::any('/get_user', 'UserController@getUser');
            //获取系统时间
            Route::any('/system', 'UserController@system');
            //修改头像
            Route::any('/portrait', 'UserController@changePortrait');
            //修改用户名
            Route::any('/user_name', 'UserController@changeUserName');
            //修改密码
            Route::any('/user_password', 'UserController@changeUserPassword');
            //获取用户的投注信息
            Route::any('/record','UserController@getUserRecord');
            //根据用户发送的字段修改用户的字段值(TODO 最好不要暴漏此接口)
            Route::any('/user_information','UserController@changeUserInformation');
            //客服
            Route::any('/custom','UserController@getCustom');
            //提取彩金
            Route::any('/touch_amount','UserController@touchAmount');
            //下注
            Route::any('/focus','UserController@focus');
            //撤销下注
            Route::any('/reverse_focus','UserController@reverseFocus');
            //普通聊天
            Route::any('/chat','UserController@chat');
            //获取所有聊天信息
            Route::any('/all_chat','UserController@getAllChat');
        });
        //逻辑处理层(台子逻辑层->限红等)
        Route::group(['prefix'=>'/table'],function () {
            //获取所有限红
            Route::any('/all_xianhong', 'TableController@getAllXianhong');
            //获取所有台子
            Route::any('/all_table', 'TableController@getAllTable');
            //获取单条公告信息
            Route::any('/gonggao', 'TableController@getGonggao');
            //获取所有公告
            Route::any('/all_gonggao', 'TableController@getAllGonggao');
            //获取历史数据(所有人的)
            Route::any('/all_record', 'TableController@getAllRecord');
            //获取历史聊天记录(单个人的)
            Route::any('/history_chat', 'TableController@getHistoryChat');
            //获取投注表
            Route::any('/bet', 'TableController@getBet');
            //获取玩家资料
            Route::any('/player', 'TableController@getPlayer');
        });
        //逻辑处理层(头像逻辑层)
        Route::group(['prefix'=>'/portrait'],function () {
            //获取系统时间
            Route::any('/all', 'PortraitController@getAllPortrait');
        });

        Route::group(['prefix'=>'/home'],function () {//todo 暂时用于测试
            Route::get('/index', 'HomeController@index');
            Route::get('/index1', 'HomeController@index1');
        });
    });
});
